Introduce new ChannelId struct#2485
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #2485 +/- ##
==========================================
+ Coverage 90.56% 90.59% +0.02%
==========================================
Files 109 110 +1
Lines 57304 57410 +106
Branches 57304 57410 +106
==========================================
+ Hits 51899 52008 +109
+ Misses 5405 5402 -3
☔ View full report in Codecov by Sentry. |
|
This overall looks like an improvement, but I'd like to maybe see what others had to say about types for different IDs like
For me currently I don't see a huge benefit in splitting all these cases into distinct types or even enum variants. So I think this PR is all we need so that we at least have type safety for channel ID bytes vs hash bytes for example. |
1b1af44 to
46cdcc5
Compare
TheBlueMatt
left a comment
There was a problem hiding this comment.
Mostly some minor process nits on commit construction, but LGTM.
50565dc to
c84dad1
Compare
|
Review comments addressed. commits regrouped (into 2 commits) as suggested. |
dunxen
left a comment
There was a problem hiding this comment.
LGTM with moving the ChannelId stuff to its own mod.
31cf609 to
7ec2b2e
Compare
|
Moved ChannelId to its own new module ( |
|
Oops sorry, yeah looks good for squash. Also missing module docs for the new module |
5a68b9a to
9b08d92
Compare
c89c64e to
5854f40
Compare
|
Per-commit check failed, fixed (moved last fix in first commit) |
|
This PR touches many logging lines, so it frequently gets in conflict with current main... I keep rebasing+resolving conflicts, but it would be nice to get more approvals ;) |
5854f40 to
59fc23b
Compare
|
Heh, sorry, been a super busy merge week. Will review now and hopefully @dunxen is still around to ack. |
TheBlueMatt
left a comment
There was a problem hiding this comment.
Two quick comments, didnt look at the second commit but i assume its fine.
59fc23b to
e99e6ab
Compare
|
Simplified as suggested (@TheBlueMatt): changed struct into a pub tuple; removed |
| use crate::chain::transaction::OutPoint; | ||
| use crate::events::{ClosureReason, Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentFailureReason, PaymentPurpose}; | ||
| use crate::ln::channel::EXPIRE_PREV_CONFIG_TICKS; | ||
| use crate::ln::channel::{EXPIRE_PREV_CONFIG_TICKS}; |
There was a problem hiding this comment.
why did you add brackets?
There was a problem hiding this comment.
Hmm, typo, after subsequent add and delete.
There was a problem hiding this comment.
Good to keep the blame layer clean (doesn't matter much for use statements), but makes it easier to read stuff back later :)
|
2 CI builds fail, likely due to #2527 . 2 approvals. |
Fixes #2408 . Introduces a new
ChannelIdstruct, enclosing the 32-byte data. It has specific constructors, for normal funding-tx-based and for temporary channel ID cases.ChannelId is exposed as
lightning::ln::ChannelId.This is a breaking change. The type of
channel_idparameter has been changed from[u8; 32]toChannelIdin severalChannelManagerAPIs, namely:create_chan_between_nodes()create_chan_between_nodes_with_value()create_funding_transaction()sign_funding_transaction()open_zero_conf_channel()create_chan_between_nodes_with_value_confirm_second()create_chan_between_nodes_with_value_confirm()create_chan_between_nodes_with_value_a()create_announced_chan_between_nodes()create_announced_chan_between_nodes_with_value()close_channel()test_txn_broadcast()The type has been changed in several events as well (
FundingGenerationReady,PaymentClaimable,PaymentForwarded,ChannelPending, etc.).Review hints:
ChannelIdstruct is inchannel.rshttps://github.com/lightningdevkit/rust-lightning/pull/2485/files#diff-8d28e96b6f27edb9a9739b2dce334f8906ec906155d421a7b5b02aa8e6c96057channelmanager.rshttps://github.com/lightningdevkit/rust-lightning/pull/2485/files#diff-2423bfc3e50222fe4bfbd77f65cb8bb78625558ace3df2ef80619bc712b634afTODO:
New macro log_channel_id!()